<?php
	/* Description: This file is used to display all category */
	#########IncludeFiles####################################################################################
	require_once '../inc/config.php';
	require_once "../inc/bootstrape.php";
	require_once _SITE_PATH_.'classes/Vendor/Vendor.php';
	require_once _SITE_PATH_.'classes/Category/Category.php';
	require_once _SITE_PATH_.'classes/Product/Product.php';
	require_once _SITE_PATH_.'classes/CommonUtility/CommonUtility.php';

	$action = trim($_REQUEST['action']);
	$id = trim($_REQUEST['id']);
	
	switch($action){
		case 'active':
			$parms['status'] = 1;
			$condition['id'] = $id;
			$row = CommonUtility::updateData($parms,$table='product',$condition);
			$errMsg = "1201" ;
		break;
		case 'deactive':
			$parms['status'] = 0;
			$condition['id'] = $id;
			$row = CommonUtility::updateData($parms,$table='product',$condition);
			$errMsg = "1202" ;
		break;
		case 'delete':
			$parms['status'] = 2;
			$condition['id'] = $id;
			$row = CommonUtility::updateData($parms,$table='product',$condition);
			$errMsg = "1203" ;
		break;
	}
	if( $errMsg ){
		header("Location: product_mng.php?msg=".$errMsg);
		exit;
	}

	$products = array();
	$products = Product::getProducts();

	$errMsg = $_GET['msg'];
	$_tplName = 'product/product_mng.tpl';
	$_title = 'Product Management';
	require_once _ADMIN_TPL_MAIN_;
?>